package top.scsoul.pas.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import top.scsoul.pas.entity.ExamInfo;

import java.util.List;


@Repository
public interface ExamInfoRepository extends JpaRepository<ExamInfo, Long> {
    @Query(value = "select * from exam_info where exam_info_creator = ?1 order by exam_info.exam_info_id desc",nativeQuery = true)
    List<ExamInfo> findAllByCreator(Long id);
    @Modifying
    @Query(value = "delete from exam_info_clazz where exam_info_clazz.clazz_id = ?1",nativeQuery = true)
    void deleteByClazzId(Long clazzId);

}
